{extend name="public/common"} {block name="body"}
<title>基本设置</title>
<style type="text/css">
	table tbody {
		display:block;
		height:650px;
		overflow-y:scroll;
		}
		
	table thead, tbody tr {
		display:table;
		width:100%;
		table-layout:fixed;
		}
		
	table thead {
		width: calc( 99.87% - 1em )
		}

	.bg-1 {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}
 .radius:hover{
 	background:#e5e5e5;
 	border-color: #e5e5e5;
 	color: #333;
 }
 span:hover{
 	color: #333;
 }

</style>
</head>
<body>
  <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    
   	财务管理
    <span class="c-gray en">&gt;</span>
    额度记录
    <span class="c-gray en">&gt;</span>
    <a href="javascript:;">额度账变</a>
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>
  <div style="padding:20px;height:30px;">
  	
  	<div class="new_box">
  <div style="height:30px;">
    <div style="float: left;width: 100%;background-color: #e5e5e5 !important;border-bottom: 1px solid #e4e7ed;height: 40px;">
      <a style="background: #636363;border-color: #636363;color: #fff;" class="btn btn-primary radius" href="{:url('Recharge/cjAccount')}">额度账变</a>
      <a style="" class="btn btn-primary radius" href="{:url('Recharge/zzAccount')}">总账变</a>
    </div>
  </div>
  
  <div class="text-c" style="padding :20px 0;">
    <form action="" enctype="application/x-www-form-urlencoded" method="get" class="l" style="margin-left:20px;">
     &nbsp;&nbsp;从：
    <input type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" name="sDate1" value="{$start|default=''}" id="sDate1" class="input-text Wdate" style="width:120px;">
     到：
    <input type="text" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" name="sDate2" value="{$end|default=''}" id="sDate2"  class="input-text Wdate" style="width:120px;margin-right:15px;">
    <input type="text" name="us_sql" value="{$us_sql|default=''}" placeholder=" 会员名称" style="width:150px" class="input-text">
    <button class="btn btn-success" type="submit" style="margin-right:20px;"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    
  </form>
  </div>
  
  <div class="page-container  dataTables_wrapper">
      <div id="tab-system" class="HuiTab">
        <div class="tabCon">
          <div class="mt-20">
            <table
              class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                <th>交易单号</th>
                <th>会员账号</th>
                <th>交易类别</th>
                <th>交易前金额</th>
                <th>交易金额</th>
                <th>优惠金额</th>
                <th>交易后金额</th>
				<th>充值时间</th>
                </tr>
              </thead>
              <tbody id="data_content" >
			  {foreach($query as $item)}
                <tr class="text-c">
                	<td>C{$item.cztime}{$item.id}</td>
                	<td>{$item.username}</td>
                	<td>{if($item.type==2)}充值{/if}{if($item.type==1)}提现{/if}{if($item.type==0)}彩金发放{/if}</td>
                	<td class="all_td" data="{if($item.type==2)}
                	{$item.czhje-$item.je-$item.hy_zsje-$item.hy_msje|sprintf="%.2f",###}
                	{/if}
                	{if($item.type==1)}
                	{$item.czhje+$item.je}
                	{/if}
                	{if($item.type==0)}
                	{$item.czhje-$item.je}
                	{/if}">
                	
                	</td>
                	<td>{if($item.type==1)}-{else/}+{/if}{$item.je}</td>
                	<td>{$item.hy_zsje+$item.hy_msje+$item.ext}</td>
                	<td>{$item.czhje}</td>
                  	<td>{$item.cztime|date="Y-m-d H:i:s",###}</td>
                </tr>
			  {/foreach}
              </tbody>
            </table>
          </div>
        </div>
      </div>
   
  </div>
  </div>
   
  </div>
{/block}

{block name="js"}
<script type="text/javascript" src="__SYSMET__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript">
 $(function() {
   $('.skin-minimal input').iCheck({
     checkboxClass : 'icheckbox-blue',
     radioClass : 'iradio-blue',
     increaseArea : '20%'
   });
   $("#tab-system").Huitab({
     index : 0
   });
    var allTd=document.getElementsByClassName('all_td')
	for(var i=0;i<allTd.length;i++){
	var str_td=parseFloat(allTd[i].getAttribute('data'))
	   var str_td_two=str_td.toFixed(2)
		allTd[i].innerHTML=str_td_two
	}
   /*var name_array = new Array();
   var name_repeat = new Array();
   $("#data_content .text-c").each(function(k,v){
	   var name = $(this).children("td[data-name]").data("name");
	   if(name_array[name] == undefined){
		   name_array[name] = 0;
		   return true;
	   }
	   if(name_array[name] == 0){
		   name_repeat[name] = 1;
		   name_repeat[name] += 1;
		   name_array[name] += 1;
		   return true;
	   }
	   name_repeat[name] += 1;
   })

	for(v in name_repeat){
		var val = name_repeat[v];
		for(i=0;i<val;i++){
			var czqje = $("#data_content .text-c").children("td[data-name="+v+"]:eq("+i+")").siblings("td[data-czqje]").data("czqje");
			var czhje = $("#data_content .text-c").children("td[data-name="+v+"]:eq("+(i+1)+")").siblings("td[data-czhje]").data("czhje");
			if(czqje != czhje && czhje != null){
				$("#data_content .text-c").children("td[data-name="+v+"]:eq("+i+")").siblings("td[data-czqje]").css("color","red");
				$("#data_content .text-c").children("td[data-name="+v+"]:eq("+i+1+")").siblings("td[data-czhje]").css("color","red");
			}
			console.log(czhje)
		}
	}*/
 });
    
</script>

{/block}
